import java.util.Scanner;
public class java25
{
    public static void main(String [] args)
    {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int ans1=0;
        int ans2=0;
        while(a>=b)
        {
            a=a-b;
            ans2++;
        }
        ans1=a;
        ans2=b;
        System.out.print(a+" "+b);
        System.out.println();
    }
}